//
//  TKYDateView.m
//  StationHouseHelper
//
//  Created by apple on 2018/7/10.
//  Copyright © 2018年 铁科院. All rights reserved.
//

#import "TKYDateView.h"
@interface TKYDateView()
/**
 起始时间
 */
@property (nonatomic, strong)UILabel *starDateLabel;


/**
 结束时间
 */
@property (nonatomic, strong)UILabel *endDateLabel;

@property (nonatomic, strong)UILabel *bottonLine;
@end
@implementation TKYDateView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        [self addSubview:self.starDateLabel];
        [self addSubview:self.endDateLabel];
        [self addSubview:self.startDateView];
        [self addSubview:self.endDateView];
        [self addSubview:self.bottonLine];
        
        [self.starDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).with.offset(kWidthScale *10);
            //make.right.equalTo(self.qualityButton.mas_left).with.offset(kHeightScale *5);
            make.top.equalTo(self).with.offset(kHeightScale *5);
            make.height.mas_equalTo(kHeightScale *25);
            make.width.mas_equalTo(kWidthScale *55);
        }];
        
        [self.startDateView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.starDateLabel.mas_right).with.offset(kWidthScale *5);
            make.top.equalTo(self.starDateLabel.mas_top);
            make.height.mas_equalTo(kHeightScale *25);
            make.width.mas_equalTo(kWidthScale *110);
        }];
        
        //
        [self.endDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.startDateView.mas_right).with.offset(kWidthScale *15);
            //make.right.equalTo(self.qualityButton.mas_left).with.offset(kHeightScale *5);
            make.top.equalTo(self.startDateView.mas_top);
            make.height.mas_equalTo(kHeightScale *25);
            make.width.mas_equalTo(kWidthScale *55);
        }];
        
        [self.endDateView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.endDateLabel.mas_right).with.offset(kWidthScale *5);
            make.right.equalTo(self).with.offset(-kHeightScale *10);
            make.top.equalTo(self.starDateLabel.mas_top);
            make.height.mas_equalTo(kHeightScale *25);
            make.width.mas_equalTo(kWidthScale *110);
            
        }];
        
        [self.bottonLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).with.offset(kWidthScale *0);
            make.right.equalTo(self).with.offset(kHeightScale *0);
            make.bottom.equalTo(self).with.offset(-kHeightScale *1);
            make.height.mas_equalTo(kHeightScale *1);
        }];
    }
    return self;
}

- (UILabel *)starDateLabel{
    if (_starDateLabel == nil) {
        _starDateLabel = [[UILabel alloc]init];
        _starDateLabel.text = @"起始时间:";
        _starDateLabel.font = Font(12);
        _starDateLabel.font = Font(12);
        _starDateLabel.textColor = kUIColorFromRGB(666666, 1);
    }
    return _starDateLabel;
}

- (UILabel *)endDateLabel{
    if (_endDateLabel == nil) {
        _endDateLabel = [[UILabel alloc]init];
        _endDateLabel.text = @"结束时间:";
        _endDateLabel.font = Font(12);
        _endDateLabel.font = Font(12);
        _endDateLabel.textColor = kUIColorFromRGB(666666, 1);
    }
    return _endDateLabel;
}

- (TKYSelectedDateView *)startDateView{
    if (_startDateView == nil) {
        _startDateView = [[TKYSelectedDateView alloc]init];
    }
    return _startDateView;
}

- (TKYSelectedDateView *)endDateView{
    if (_endDateView == nil) {
        _endDateView = [[TKYSelectedDateView alloc]init];
    }
    return _endDateView;
}

- (UILabel *)bottonLine{
    if (_bottonLine == nil) {
        _bottonLine = [[UILabel alloc]init];
        _bottonLine.backgroundColor = kMainColour;
    }
    return _bottonLine;
}

@end
